#!/bin/bash

set -e          # exit on error
set -o pipefail # exit on pipeline error
set -u          # treat unset variable as error

. /minioslib || exit 1

SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"

pkg update
pkg install software-properties-common

#apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
curl -fsSL https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE | gpg --dearmor >/etc/apt/trusted.gpg.d/onlyoffice.gpg
add-apt-repository 'deb https://download.onlyoffice.com/repo/debian squeeze main'

# install packages
pkg update
pkg install onlyoffice-desktopeditors

PACKAGE="onlyoffice-desktopeditors"
echo "PACKAGE=$PACKAGE" >/.package
echo "VERSION=$(dpkg -s $PACKAGE | grep Version | sed 's/Version: //g' | sed 's/:/-/g')" >>/.package

pkg autoremove software-properties-common
